//
// Created by pedro on 18-10-22.
//


#include "insert_sort.h"

void insert_sort(int *data, int length) {
    for (int j = 1; j < length; ++j) {
        int key = data[j];
        int i = j - 1;
        while (i >= 0 && data[i] > key) {
            data[i + 1] = data[i];
            i -= 1;
        }
        data[i + 1] = key;
    }
}
